﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace B.S.BasicData.Infrastructures
{
    /// <summary>
    /// 仓储接口
    /// </summary>
    /// <typeparam name="T">实体</typeparam>
    public interface IBaseRepository<T>
    {
        MyDbContext DB { get; }
        
        /// <summary>
      /// 添加
      /// </summary>
      /// <param name="t">实体</param>
      /// <returns>返回受影响的函数</returns>
        Task<int> Add(T t);
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="t">实体</param>
        /// <returns>返回受影响的函数</returns>
        Task<int> Update(T t);
        /// <summary>
        /// 列表
        /// </summary>
        /// <returns>返回结果</returns>
        IQueryable<T> GetAll();
        /// <summary>
        /// 批量添加
        /// </summary>
        /// <param name="t">实体</param>
        /// <returns>返回受影响的行数</returns>
        Task<int> AddRange(List<T> t);
        /// <summary>
        ///删除
        /// </summary>
        /// <param name="t">实体</param>
        /// <returns>返回受影响的行数</returns>
        Task<int> Delete(List<T> t);
        
    }
}
